home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1997 #1 / Amiga Plus CD - 1997 - No. 01.iso / pd / programmierung / proasm / routines / gadgetgroupsupport.r < prev    next >
Text File  |  1993-10-14  |  5KB  |  190 lines

  1. ****************************************************************************
  2. *                                        *
  3. *                   ****   GadgetGroup Support.i  ****                *
  4. *                                        *
  5. *    Author        René Eberhard                        *
  6. *    Version        0.1                            *
  7. *    Last Revision    Sunday 03-Oct-93 12:20:30                *
  8. *    Identifier    gdgs_defined                        *
  9. *       Prefix        gdgs_  (gadgetgroup support)                *
  10. *                         ¯ ¯   ¯     ¯                    *
  11. *-----------------------------[ UPDATES ]----------------------------------*
  12. *                                        *
  13. *    -REB!    03-Oct-93    Start this Project               *
  14. *                                        *
  15. *-----------------------------[ COMMENT ]----------------------------------*
  16. *                                        *
  17. * This supportfile works only together with GTFace (© Sefan Walter)        *
  18. *                                        *
  19. ****************************************************************************
  20. ****************************************************************************
  21. *---------------------------[ Functions ]----------------------------------*
  22. *                                        *
  23. * - HandleGadgetGroups                                *
  24. *                                        *
  25. ****************************************************************************
  26. ;---------------------------------------------------------------------------
  27.     IFND    gdgs_defined
  28. gdgs_defined    SET    1
  29.  
  30.  
  31. ;---------------[ Some includes ]-------------------------------------------
  32.  
  33.     INCLUDE    "special/GadgetGroupSupport.i"
  34.         
  35. ;---------------------------------------------------------------------------
  36.  
  37.     IFND    USE_NEWROUTINES
  38.     NEED_    HandleGadgetGroups
  39.     ENDIF
  40.         
  41. ;---------------------------------------------------------------------------
  42. ****************************************************************************
  43. *                                        *
  44. * NAME    : HandleGadgetGroups                            *
  45. *                                        *
  46. * SYNOPSIS:                                     *
  47. *       Result = HandleGadgetGroups (GroupList,WindowKey,Group)            *
  48. *       D0.L                         A0.L      A1.L     D0.W            *
  49. *                                        *
  50. * FUNCTION: Handles gadgetgroups                        *
  51. *                                        *
  52. * RESULT  : TRUE or FALSE                             *
  53. *                                        *
  54. ****************************************************************************
  55.     IFD    xxx_HandleGadgetGroups
  56. HandleGadgetGroups:
  57.  
  58.     PUSHM.L    d1-a6
  59.  
  60.     link    a5,#gdgs_SIZEOF
  61.  
  62.     move.l    a0,gdgs_GroupList(a5)    ;Store parameters
  63.     move.l    a1,gdgs_WindowKey(a5)
  64.  
  65. ;---------------[ Search required group ]-----------------------------------
  66.  
  67.     move.l    d0,d1            ;Group into D1.L
  68.     moveq    #0,d0            ;Result = FAIL
  69.  
  70. \GLoop:    cmp.l    #gdgs_GROUPSTART_ID,(a0)+
  71.     bne.s    \Rtn            ;There in no valid group -> Exit
  72.  
  73.     cmp.w    (a0)+,d1        ;Is this the required group?    
  74.     beq.s    \Group            ;Yes
  75.  
  76. \ELoop:    cmp.l    #gdgs_GROUPEND_ID,(a0)    ;Is there a gdgs_GROUPEND_ID
  77.     beq.s    \NextG            ;Yes, search next group
  78.     addq.l    #2,a0
  79.     bra.s    \ELoop
  80.  
  81. \NextG:    addq.l    #4,a0            ;Pointer to a possible gdgs_GROUPSTART_ID
  82.     tst.l    (a0)            ;End of grouplist?
  83.     beq.s    \Rtn            ;Yes, group not found -> FAIL
  84.  
  85.     bra.s    \GLoop            ;Continue searching in the list
  86.  
  87. ;---------------[ Handle group ]--------------------------------------------
  88.  
  89. \Group:    move.l    a0,a4                ;Put group into A4.L
  90.  
  91.     cmp.l    #gdgs_NEWGADGET_ID,(a4)+    ;Is there an ewn gadget?
  92.     bne.s    \Rtn                ;No -> Fail
  93.  
  94. \NewGg:    move.w    (a4)+,gdgs_Gadget(a5)        ;Store gadget identifier
  95.  
  96. \SetGg:    move.l    gdgs_WindowKey(a5),a2        ;Get WindowKey
  97.     move.w    gdgs_Gadget(a5),d0        ;Get gadget
  98.     CALL_    FindGadget
  99.     tst.l    d0
  100.     beq.s    \Rtn
  101.  
  102.     move.l    d0,a0                ;Gadget
  103.     move.l    gdgs_WindowKey(a5),a2        ;Get WindowKey
  104.     bsr    \GetTagData            ;Tagdata handler
  105.     CALL_    SetGadgetTag            ;Set gadget
  106.  
  107.     cmp.l    #gdgs_GROUPEND_ID,(a4)        ;End of grouplist?
  108.     beq.s    \Exit
  109.  
  110.     cmp.l    #gdgs_NEWGADGET_ID,(a4)        ;End of gadget?
  111.     bne.s    \SetGg                ;Continue with setting gadgets
  112.  
  113.     addq.l    #4,a4                ;Leave out gdgs_NEWGADGET_ID
  114.     bra.s    \NewGg                ;There is a new gadget
  115.         
  116. ;---------------[ Exit HandleGadgetGroups ]---------------------------------
  117.  
  118. \Exit:    moveq    #-1,d0                ;Flag for TRUE
  119.  
  120. \Rtn:    unlk    a5
  121.     POPM.L    d1-a6
  122.     rts
  123.         
  124. ;---------------------------------------------------------------------------
  125. ****************************************************************************
  126. *                                        *
  127. * SUBFUNCTION : \GetTagData()                            *
  128. *                                        *
  129. ****************************************************************************
  130.  
  131. \GetTagData:
  132.     move.l    (a4)+,d1            ;Tag identifier
  133.  
  134.     lea    \SpecialTagList(PC),a3
  135.  
  136. \TLoop:    move.l    (a3)+,d0            ;Get special tags
  137.     beq.s    \Def                ;No more tags left -> default handling
  138.  
  139.     cmp.l    d0,d1                ;Is it a special tag
  140.     beq.s    \Indi                ;Yes -> indirect handling
  141.  
  142.     bra.s    \TLoop                ;Loop
  143.         
  144. ;---------------[ Default handling ]----------------------------------------
  145.  
  146. \Def:    move.l    (a4)+,d0            ;Get data direct
  147.     rts
  148.  
  149. ;---------------------------------------------------------------------------
  150. ****************************************************************************
  151. *                                        *
  152. * ROUTINE \Indi()                                 *
  153. *                                        *
  154. *-----------------------------[ COMMENT ]----------------------------------*
  155. *                                        *
  156. * This routine part in only a test! So don't cry =)                *
  157. *                                        *
  158. ****************************************************************************
  159.  
  160. \Indi:    move.l    (a4)+,a3            ;Get data indirect
  161.  
  162.     cmp.l    #GTSL_Level,d1            ;Wordread only
  163.     beq.s    \Word
  164.  
  165.     move.l    (a3),d0
  166.  
  167.     rts
  168.  
  169. \Word:    clr.l    d0
  170.     move.w    (a3),d0
  171.  
  172.     rts
  173.  
  174. ;---------------------------------------------------------------------------
  175.  
  176. \SpecialTagList:    dc.l    GTIN_Number,GTSL_Level
  177.             dc.l    0
  178.  
  179.             FORESET
  180. gdgs_GroupList:        FO.L    1
  181. gdgs_WindowKey:        FO.L    1
  182. gdgs_Gadget:        FO.W    1
  183. gdgs_SIZEOF        FOVAL
  184.  
  185.     ENDC
  186.  
  187. ;---------------------------------------------------------------------------
  188.         ENDC
  189. ;---------------------------------------------------------------------------
  190.